import request from '@/utils/request'
import type { VideoListParams, VideoListResponse, VideoDetailResponse } from '@/types/video'

// 获取直播列表
export const getLiveList = (params: VideoListParams) => {
  return request.get<VideoListResponse>('/video/live/list', { params })
}

// 获取附近直播列表
export const getNearbyLiveList = (params: VideoListParams) => {
  return request.get<VideoListResponse>('/video/live/nearby', { params })
}

// 获取视频详情
export const getVideoDetail = (id: string | number) => {
  return request.get<VideoDetailResponse>(`/video/detail/${id}`)
}

// 获取视频分类列表
export const getVideoCategories = () => {
  return request.get<VideoListResponse>('/video/categories')
}

// 获取分类下的视频列表
export const getCategoryVideos = (category: string, params: VideoListParams) => {
  return request.get<VideoListResponse>(`/video/category/${category}`, { params })
}
